{template 'common/header'}
{template 'common_css'}

<ul class="nav nav-tabs">
	<li {if $operation == 'post' && empty($id)}class="active"{/if}><a href="{php echo $this->createWebUrl('category', array('op' => 'post'))}">添加分类</a></li>
	<li {if $operation == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('category', array('op' => 'display'))}">管理分类</a></li>
	{if $operation == 'reply' && !empty($id) && !empty($rid)}<li {if $operation == 'reply'}class="active"{/if}><a href="{php echo $this->createWebUrl('category', array('op' => 'reply','id' => $id,'rid' => $rid))}">关键字设置</a></li>{/if}
    {if $operation == 'post' && !empty($id)}<li class="active"><a href="#">
    编辑分类
    </a></li>{/if}
</ul>

{if $operation == 'post'}

<div class="main">

    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
        <div class="panel panel-default">
            <div class="panel-heading">分类详细设置</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类名称</label>
                    <div class="col-sm-9">
                        <input type="text" name="title" class="form-control" value="{$cate['title']}" />
                    </div>
				</div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">图标</label>
                    <div class="col-xs-12 col-sm-9">
                         {php echo tpl_form_field_image('thumb',$cate['icon']);}
                    </div>
                </div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">主题列表显示</label>
					<div class="col-xs-12 col-sm-9">
						<div class="btn-group" data-toggle="buttons">					  
							<label class="btn btn-default {if empty($cate) || $cate['list'] == '1'}active{/if}"><input type="radio" name="list" value="1" {if empty($cate) || $cate['list'] == 1}checked="checked"{/if} >一行1个主题</label>
							<label class="btn btn-default {if $cate['list'] == '3'}active{/if}"><input type="radio" name="list" value="3" {if !empty($cate) && $cate['list'] == 3} checked="checked"{/if}>一行3个主题</label>
							<label class="btn btn-default {if $cate['list'] == '4'}active{/if}"><input type="radio" name="list" value="4" {if !empty($cate) && $cate['list'] == 4} checked="checked"{/if}>一行4个主题</label>
						</div>
					</div>
				</div> 
				<div class="form-group">
					<label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">分类导航栏景色</label>
					<div class="col-sm-9 col-xs-12">
					<div class="input-group">
						{php echo tpl_form_field_color('nav_index', $color['nav_index']);}
					</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">介绍导航栏背景色</label>
					<div class="col-sm-9 col-xs-12">
					<div class="input-group">
						{php echo tpl_form_field_color('nav_page', $color['nav_page']);}
					</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">分类按钮栏背景色</label>
					<div class="col-sm-9 col-xs-12">
					<div class="input-group">
						{php echo tpl_form_field_color('nav_btn', $color['nav_btn']);}
					</div>
					</div>
				</div>          
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
    </form>
</div>
<script type="text/javascript" src="../web/resource/components/colorpicker/spectrum.js"></script>
<link type="text/css" rel="stylesheet" href="../web/resource/components/colorpicker/spectrum.css" />
<script type="text/javascript">
<!--
	$(function(){
		colorpicker();
	});
//-->
</script>
{elseif $operation == 'display'}

<div class="main">
    <div class="store">
        <form action="" method="post" onsubmit="return formcheck(this)">
			<div class="panel panel-default">
				<div class="panel-body table-responsive">
					<table class="table table-hover">
						<thead>
							<tr>
								<th class="text-center" style="width:50px;">ID</th>
								<th>分类名称</th>
								<th>链接</th>
								<th style="width:20%;">颜色</th>
								<th style="width:180px;">操作</th>
							</tr>
						</thead>
						<tbody>
			{loop $category $row}
				<tr>
					<td class="text-center">{$row['id']}</td>
					<td><div class="type-parent">{$row['title']}</div></td>
					<td style="position:relative;">
						<span class="pull-left"><a class="btn btn-default js-clip" href="javascript:;" data-url="{$row['link']}">复制链接</a></span>
					</td>
					<td>
						<span class="badge" style="background-color:{if $row['color']['nav_index']}{$row['color']['nav_index']}{else}#5c6bc0{/if}">导航栏</span>
						<span class="badge" style="background-color:{if $row['color']['nav_page']}{$row['color']['nav_page']}{else}#4db6ac{/if}">介绍导航栏</span>
						<span class="badge" style="background-color:{if $row['color']['nav_btn']}{$row['color']['nav_btn']}{else}#5c6bc0{/if}">按钮</span>
					</td>
					<td>
						<a href="{php echo $this->createWebUrl('category', array('op' => 'post', 'id' => $row['id']))}" class="btn btn-default"><i class="fa fa-edit"></i> 编辑</a>
						<a href="{php echo $this->createWebUrl('category', array('op' => 'delete', 'id' => $row['id']))}" class="btn btn-danger" onclick="return confirm('确认删除此分类吗？');return false;"><i class="fa fa-remove"></i> 删除</a>
					</td>
				</tr>
			{/loop}
			</tbody>
					</table>
				</div>
           </div>
		<div class="form-group col-sm-12">
			<a href="{php echo $this->createWebUrl('category', array('op' => 'post'))}" class="btn btn-default btn-primary"><i class="fa fa-plus-circle"></i> 添加新分类</a>
		</div>
        </form>
{$pager}
    </div>
</div>
{/if}
{template 'common/footer'}